export function setupRouterGuards(router) {
  router.beforeEach((to, from, next) => {
    // 显示加载进度条
    window.$loadingBar?.start()
    next()
  })

  router.afterEach(() => {
    // 完成进度条
    window.$loadingBar?.finish()
  })

  router.onError(() => {
    // 发生错误时结束进度条
    window.$loadingBar?.error()
  })
}
